#include <bits/stdc++.h>
using namespace std;
long long Min=100001,Max=-1,ans;
long long n,num,useful_bucket[100001],stay_bucket[100001];
long long next_min(long long _min,long long _max)
{
    if(_min==_max)
    {
        for(int i=Min;i<_max;i++)
        {
            if(stay_bucket[i])
            return Max;
        }
    }
    for(int i=_min+1;i<=_max;i++)
    {
        if(useful_bucket[i])
            return i;
    }
    return -1;
}
int main()
{
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    cin>>n;
    for(int i=1;i<=n;i++)
    {
        cin>>num;
        useful_bucket[num]++;
        stay_bucket[num]++;
        Min=min(Min,num);
        Max=max(Max,num);
    }
    if(Min==Max)
    {
        cout<<n;
        return 0;
    }
    for(int i=Min;i<=Max;i++)
    {
        if(useful_bucket[i-1])
            i--;
        if(useful_bucket[i])
        {
            if(next_min(i,Max)==-1)
                break;
            useful_bucket[i]--;
            useful_bucket[next_min(i,Max)]--;
            stay_bucket[i]--;
        }
    }
    for(int i=Min;i<=Max;i++)
    {
        if(stay_bucket[i])
            ans+=stay_bucket[i];
    }
    cout<<ans;
    return 0;
}
